using Holoville.HOTween;
using UnityEngine;

public class RewardMessage : MonoBehaviour
{
	public float liveTime = 2f;

	private UIWidget messageWiget;

	public static RewardMessage instance;

	private void Awake()
	{
		instance = this;
	}

	private void Start()
	{
		messageWiget = GetComponent<UIWidget>();
		if ((bool)messageWiget)
		{
			messageWiget.alpha = 0f;
			HOTween.Init();
			HOTween.Kill(messageWiget);
			HOTween.To(messageWiget, 0.5f, new TweenParms().Prop("alpha", 1));
		}
	}

	private void RemoveWithAnimation()
	{
		if ((bool)messageWiget)
		{
			HOTween.To(messageWiget, 0.5f, new TweenParms().Prop("alpha", 0));
		}
		Invoke("DestroyMe", 0.5f);
	}

	private void DestroyMe()
	{
		instance = null;
		GameplayRewardManager.instance.ShowNextMessage();
		Object.Destroy(base.gameObject);
	}
}
